package admin

import (
	"gitee.com/gopher2011/gin"
	"gitee.com/gopher2011/mall/app/service"
	"net/http"
	"strconv"
)

// 会员等级管理 管理对象。
var UmsMemberLevel = &umsMemberLevelApi{}

type umsMemberLevelApi struct{}

// 查询所有会员等级 /list	Get 参数: default_status
func (it *umsMemberLevelApi) List(r *gin.Context) {
	str := r.Query("default_status")
	id, _ := strconv.Atoi(str)
	res, err := service.UmsMemberLevel.List(int32(id))
	if err != nil {
		r.JSON(http.StatusBadRequest, gin.H{"msg": "查询所有会员等级失败!"})
		r.Abort()
	} else {
		r.JSON(http.StatusOK, gin.H{"msg": "查询所有会员等级成功!", "data": res})
	}
}
